package org.ling.xuan.customnew;

import com.intellij.openapi.project.Project;
import com.intellij.openapi.ui.DialogWrapper;
import com.intellij.ui.components.JBTabbedPane;
import org.jetbrains.annotations.Nullable;

import javax.swing.*;

public class HundSunFileTemplateDialog extends DialogWrapper {
    private final JBTabbedPane tabbedPane;
    
    public HundSunFileTemplateDialog(@Nullable Project project, boolean canBeParent) {
        super(project, canBeParent);
        setTitle("Setting Configuration");
        tabbedPane = new JBTabbedPane();
        for(HundSunFileTemplate template:FileTemplateManage.templates){
            tabbedPane.addTab(template.getTabName(),template.newPanel());
        }
        init();
    }

    @Override
    protected @Nullable JComponent createCenterPanel() {
        return tabbedPane;
    }

    public HundSunFileTemplate getSelectedTemplate() {
        return FileTemplateManage.templates.get(tabbedPane.getSelectedIndex());
    }
}
